<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.zhengyuedong.bbs.core.entity.User" %>
<%
User currentUser = (User) request.getSession().getAttribute("currentUser");
String displayName = "";
String isLogin = "";
if (currentUser != null) {
	displayName = currentUser.getDisplayName();
	if ("".equals(displayName) || displayName == null) {
		displayName = currentUser.getLoginName();
	}
	isLogin = "Y";
}
%>
<div id="header">
  <div id="site_title">
    <div id="logo">LOGO</div>
    <div id="searchbar">
      <form action="searchTopic.action" method="get">
        <input name="searchkey" type="text" size="30" />
        <input name="search" type="button" value="搜索" />
      </form>
    </div>
  </div>
  <div id="navbar">
    <ul>
    <%
    if ("Y".equals(isLogin)) {
    %>
      <li>hello, <%=displayName%></li>
      <li><a href="<%=request.getContextPath()%>">首页</a></li>
    <%
    } else {
    %>
      <li><a href="<%=request.getContextPath()%>">首页</a></li>
      <li><a href="<%=request.getContextPath()%>/preRegUser.action">注册</a></li>
      <li><a href="<%=request.getContextPath()%>/loginUser.action">登入</a></li>
    <%
    }
    %>
    </ul>
  </div>
</div>
